// $ANTLR 3.4 /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g 2013-10-23 12:42:14

import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

import org.antlr.runtime.debug.*;
import java.io.IOException;
@SuppressWarnings({"all", "warnings", "unchecked"})
public class CIPAufgabe1Parser extends DebugParser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "Equ", "Num", "Op"
    };

    public static final int EOF=-1;
    public static final int Equ=4;
    public static final int Num=5;
    public static final int Op=6;

    // delegates
    public Parser[] getDelegates() {
        return new Parser[] {};
    }

    // delegators


public static final String[] ruleNames = new String[] {
    "invalidRule", "tripleequal", "tripleop", "expression", "num", "program"
};

public static final boolean[] decisionCanBacktrack = new boolean[] {
    false, // invalid decision
    false
};

 
    public int ruleLevel = 0;
    public int getRuleLevel() { return ruleLevel; }
    public void incRuleLevel() { ruleLevel++; }
    public void decRuleLevel() { ruleLevel--; }
    public CIPAufgabe1Parser(TokenStream input) {
        this(input, DebugEventSocketProxy.DEFAULT_DEBUGGER_PORT, new RecognizerSharedState());
    }
    public CIPAufgabe1Parser(TokenStream input, int port, RecognizerSharedState state) {
        super(input, state);
        DebugEventSocketProxy proxy =
            new DebugEventSocketProxy(this, port, null);

        setDebugListener(proxy);
        try {
            proxy.handshake();
        }
        catch (IOException ioe) {
            reportError(ioe);
        }
    }

public CIPAufgabe1Parser(TokenStream input, DebugEventListener dbg) {
    super(input, dbg, new RecognizerSharedState());
}

protected boolean evalPredicate(boolean result, String predicate) {
    dbg.semanticPredicate(result, predicate);
    return result;
}

    public String[] getTokenNames() { return CIPAufgabe1Parser.tokenNames; }
    public String getGrammarFileName() { return "/Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g"; }



    // $ANTLR start "program"
    // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:3:1: program : expression tripleop expression tripleequal expression ;
    public final void program() throws RecognitionException {
        try { dbg.enterRule(getGrammarFileName(), "program");
        if ( getRuleLevel()==0 ) {dbg.commence();}
        incRuleLevel();
        dbg.location(3, 0);

        try {
            // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:3:8: ( expression tripleop expression tripleequal expression )
            dbg.enterAlt(1);

            // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:3:11: expression tripleop expression tripleequal expression
            {
            dbg.location(3,11);
            pushFollow(FOLLOW_expression_in_program10);
            expression();

            state._fsp--;

            dbg.location(3,22);
            pushFollow(FOLLOW_tripleop_in_program12);
            tripleop();

            state._fsp--;

            dbg.location(3,31);
            pushFollow(FOLLOW_expression_in_program14);
            expression();

            state._fsp--;

            dbg.location(3,42);
            pushFollow(FOLLOW_tripleequal_in_program16);
            tripleequal();

            state._fsp--;

            dbg.location(3,54);
            pushFollow(FOLLOW_expression_in_program18);
            expression();

            state._fsp--;


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        dbg.location(4, 2);

        }
        finally {
            dbg.exitRule(getGrammarFileName(), "program");
            decRuleLevel();
            if ( getRuleLevel()==0 ) {dbg.terminate();}
        }

        return ;
    }
    // $ANTLR end "program"



    // $ANTLR start "expression"
    // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:5:1: expression : num Op num Equ num ;
    public final void expression() throws RecognitionException {
        try { dbg.enterRule(getGrammarFileName(), "expression");
        if ( getRuleLevel()==0 ) {dbg.commence();}
        incRuleLevel();
        dbg.location(5, 0);

        try {
            // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:5:12: ( num Op num Equ num )
            dbg.enterAlt(1);

            // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:5:13: num Op num Equ num
            {
            dbg.location(5,13);
            pushFollow(FOLLOW_num_in_expression27);
            num();

            state._fsp--;

            dbg.location(5,18);
            match(input,Op,FOLLOW_Op_in_expression30); 
            dbg.location(5,22);
            pushFollow(FOLLOW_num_in_expression33);
            num();

            state._fsp--;

            dbg.location(5,27);
            match(input,Equ,FOLLOW_Equ_in_expression36); 
            dbg.location(5,32);
            pushFollow(FOLLOW_num_in_expression39);
            num();

            state._fsp--;


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        dbg.location(7, 2);

        }
        finally {
            dbg.exitRule(getGrammarFileName(), "expression");
            decRuleLevel();
            if ( getRuleLevel()==0 ) {dbg.terminate();}
        }

        return ;
    }
    // $ANTLR end "expression"



    // $ANTLR start "num"
    // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:8:1: num : ( Num )+ ;
    public final void num() throws RecognitionException {
        try { dbg.enterRule(getGrammarFileName(), "num");
        if ( getRuleLevel()==0 ) {dbg.commence();}
        incRuleLevel();
        dbg.location(8, 0);

        try {
            // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:8:6: ( ( Num )+ )
            dbg.enterAlt(1);

            // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:8:7: ( Num )+
            {
            dbg.location(8,7);
            // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:8:7: ( Num )+
            int cnt1=0;
            try { dbg.enterSubRule(1);

            loop1:
            do {
                int alt1=2;
                try { dbg.enterDecision(1, decisionCanBacktrack[1]);

                int LA1_0 = input.LA(1);

                if ( (LA1_0==Num) ) {
                    alt1=1;
                }


                } finally {dbg.exitDecision(1);}

                switch (alt1) {
            	case 1 :
            	    dbg.enterAlt(1);

            	    // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:8:7: Num
            	    {
            	    dbg.location(8,7);
            	    match(input,Num,FOLLOW_Num_in_num50); 

            	    }
            	    break;

            	default :
            	    if ( cnt1 >= 1 ) break loop1;
                        EarlyExitException eee =
                            new EarlyExitException(1, input);
                        dbg.recognitionException(eee);

                        throw eee;
                }
                cnt1++;
            } while (true);
            } finally {dbg.exitSubRule(1);}


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        dbg.location(9, 2);

        }
        finally {
            dbg.exitRule(getGrammarFileName(), "num");
            decRuleLevel();
            if ( getRuleLevel()==0 ) {dbg.terminate();}
        }

        return ;
    }
    // $ANTLR end "num"



    // $ANTLR start "tripleequal"
    // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:10:1: tripleequal : Equ Equ Equ ;
    public final void tripleequal() throws RecognitionException {
        try { dbg.enterRule(getGrammarFileName(), "tripleequal");
        if ( getRuleLevel()==0 ) {dbg.commence();}
        incRuleLevel();
        dbg.location(10, 0);

        try {
            // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:10:13: ( Equ Equ Equ )
            dbg.enterAlt(1);

            // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:10:14: Equ Equ Equ
            {
            dbg.location(10,14);
            match(input,Equ,FOLLOW_Equ_in_tripleequal61); 
            dbg.location(10,19);
            match(input,Equ,FOLLOW_Equ_in_tripleequal64); 
            dbg.location(10,24);
            match(input,Equ,FOLLOW_Equ_in_tripleequal67); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        dbg.location(11, 2);

        }
        finally {
            dbg.exitRule(getGrammarFileName(), "tripleequal");
            decRuleLevel();
            if ( getRuleLevel()==0 ) {dbg.terminate();}
        }

        return ;
    }
    // $ANTLR end "tripleequal"



    // $ANTLR start "tripleop"
    // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:12:1: tripleop : Op Op Op ;
    public final void tripleop() throws RecognitionException {
        try { dbg.enterRule(getGrammarFileName(), "tripleop");
        if ( getRuleLevel()==0 ) {dbg.commence();}
        incRuleLevel();
        dbg.location(12, 0);

        try {
            // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:12:10: ( Op Op Op )
            dbg.enterAlt(1);

            // /Users/iamapo/Downloads/CI Praktikum 1/CIPAufgabe1.g:12:12: Op Op Op
            {
            dbg.location(12,12);
            match(input,Op,FOLLOW_Op_in_tripleop79); 
            dbg.location(12,15);
            match(input,Op,FOLLOW_Op_in_tripleop81); 
            dbg.location(12,18);
            match(input,Op,FOLLOW_Op_in_tripleop83); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        dbg.location(13, 2);

        }
        finally {
            dbg.exitRule(getGrammarFileName(), "tripleop");
            decRuleLevel();
            if ( getRuleLevel()==0 ) {dbg.terminate();}
        }

        return ;
    }
    // $ANTLR end "tripleop"

    // Delegated rules


 

    public static final BitSet FOLLOW_expression_in_program10 = new BitSet(new long[]{0x0000000000000040L});
    public static final BitSet FOLLOW_tripleop_in_program12 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_expression_in_program14 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_tripleequal_in_program16 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_expression_in_program18 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_num_in_expression27 = new BitSet(new long[]{0x0000000000000040L});
    public static final BitSet FOLLOW_Op_in_expression30 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_num_in_expression33 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_Equ_in_expression36 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_num_in_expression39 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_Num_in_num50 = new BitSet(new long[]{0x0000000000000022L});
    public static final BitSet FOLLOW_Equ_in_tripleequal61 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_Equ_in_tripleequal64 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_Equ_in_tripleequal67 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_Op_in_tripleop79 = new BitSet(new long[]{0x0000000000000040L});
    public static final BitSet FOLLOW_Op_in_tripleop81 = new BitSet(new long[]{0x0000000000000040L});
    public static final BitSet FOLLOW_Op_in_tripleop83 = new BitSet(new long[]{0x0000000000000002L});

}